<script type="text/javascript">

	
	$(function(){	
		//$("input[name='producttaskedTotal']").removeAttr("checked");
		$.get("parameterCard/getCardInfo",function(data){
			var contenta="<option value='' selected>请选择</option>";
			var contentb="<option value='' selected>请选择</option>";
			$(data).each(function(n,item){
				
				//20180309 惠国磊 以下4行  增加
				for(i=0;i<item.cardTypes.length;i++){
					if(item.cardTypes[i].cardTypeCode==item.cardTypeCode){
						contenta+="<option value="+item.cardTypes[i].cardTypeCode+" selected>"
						+item.cardTypes[i].cardTypeName+"</option>"
					}else{
						contenta+="<option value="+item.cardTypes[i].cardTypeCode+">"
						+item.cardTypes[i].cardTypeName+"</option>"
					}
					
				}
				for(i=0;i<item.cdProDefinitions.length;i++){
					if(item.cdProDefinitions[i].cardpCode==item.cardpCode){
						contentb+="<option value="+item.cdProDefinitions[i].cardpCode+" selected>"
						+item.cdProDefinitions[i].cardpName+"</option>"
				}else{
					contentb+="<option value="+item.cdProDefinitions[i].cardpCode+">"
					+item.cdProDefinitions[i].cardpName+"</option>"
				}
					
				}
				//全选按钮初始化，如果之前选中了，清除
				$("#cardTypeCodeByQuery").html(contenta);
				$("#cardpCodeByQuery").html(contentb);
				
				$.post("parameterCard/getCardProductD",getCardProductD,"json");
			});
		},"json");

		
		
		})


//去修改页面
function updateProduct(){
	//20180310 惠国磊  以下1 行  修改
	if($("input[name='producttasked']:checked").length < 1){
		 alertMsg.warn("您未选择数据！")
		 return false;
	}
	//20180310 惠国磊  以下1行  修改
	if($("input[name='producttasked']:checked").length > 1){
		 alertMsg.warn("不能选择多于1条数据！")
		 return false;
	}
	var parm="";
	var paramArray;
	var itemArray;
	var options = new Object();
	options.width=600;
	options.height=500;
	$("input[name='producttasked']:checked").each(function(n,item){
		paramArray=$(this).val().split(",")
		//20180309 惠国磊 以下1 行  修改
		/* for(var i=0;i<paramArray.length;i++){
			itemArray=paramArray[i].split(":");
			var itemAttribute = itemArray[0];
			var itemValue = itemArray[1];
			options.itemAttribute=itemValue;
		} */
		parm=paramArray[paramArray.length-1].split(":")[1];
	});	
	/* //20180316 惠国磊 以下 行 增加
	//将页面上查询框中条件值传到下个画面
	var cardTCode = $("#cardTypeCodeByQuery").val();
	var cardPCode = $("#cardpCodeByQuery").val();
	//将页面上分页相关的信息传到下个画面处理
	var numPerPage = $("#numPerPageByproduct").val();
	var currentPage = $("input[name='currentPage']").val();
	var pageCount = $("input[name='pageCount']").val();
	options.cardTCode = cardTCode;
	options.cardPCode = cardPCode;
	options.pageCount = pageCount;
	options.currentPage = currentPage;
	options.numPerPage = numPerPage; */
	options.param=parm;
	//20180309 惠国磊  以下1行 修改
	$.pdialog.open("parameterCard/goUpdateProductTask","infos", "修改信息",options);
}


function validateCheckBox(a){
	var parm=$(a).text();
	var param =$(a).children().val();
	if(parm=="未启用"){
		$.ajax({
	        url:"parameterCard/startProduct",
	        data: {"param":param},
	        dataType: "json",
	    	type:"post",
	    	success:function(json){
	        	$.ajax({
	        		url:"parameterCard/getCardProductD",
	                dataType: "json",
	            	type:"post",
	                success:getCardProductD
	    		})
	        }
		})
		return true;
	}
	return false;
}
</script>
<div class="pageHeader ">
	<form id="pagerForm" method="post"
		action="parameterCard/getCardProductD"
		class="pageForm required-validate"
		onsubmit="return validateCallback(this,getCardProductD);">
		<input type="hidden" name="pageNum" value="" /> <input type="hidden"
			name="numPerPage" value="" />
		<!-- <input type="hidden" name="pageCount" value="" /> -->
		<div class="searchBar">
			<div class="row" style="padding: 0 10px;">
				<div class="col-md-6 col-sm-12">
					<p>
						<label>卡产品类型：</label><select id="cardTypeCodeByQuery"
							name="cardTypeCode" class="">
						</select>
					</p>
				</div>
				<div class="col-md-6 col-sm-12">
					<p>
						<label>卡产品名称：</label><select id="cardpCodeByQuery" name="cardpCode"
							></select>
					</p>
				</div>
			</div>
			<div class="subBar">
				<ul>
					<li>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">查询</button>
							</div>
						</div>
					</li>
				</ul>
			</div>
		</div>
	</form>
</div>

<!-- 20180311 惠国磊  以下1 行   修改 -->
<form method="post" action="parameterCard/startProduct" class=""
	onsubmit="return validateCallback(this,navTabAjaxDone);">
	<div class="pageContent">
		<div class="panelBar">
			<ul class="toolBar">
				<li><a class="add" href="parameterCard/addCardProduct"
					target="dialog" rel="CardProductDefinition" width="900" height="500"><span>新增</span></a></li>
				<!-- <li><a class="delete" onclick="return deleteCardProduct();"><span>删除</span></a></li> -->
				<li><a class="edit" onclick="return updateProduct();"><span>修改</span></a></li>
			</ul>
		</div>
		<!-- <input name="producttasked" type="checkbox" style="display:none" value="xxxxxxxxxxx" checked> -->
		<div id="ByCardProduct">
			<table class="table" width="100%" layoutH="220">
				<thead>
					<tr>
						<!-- <th width="2%" align="center"><input type="checkbox"
							name="producttaskedTotal" group="producttasked"
							class="checkboxCtrl"></th> -->
						<th width="3%">选择</th>
						<!--20180309  惠国磊 以下1行 增加  -->
						<th width="3%" align="center">序号</th>
						<!--20180309  惠国磊 以下1行 修改  -->
						<th width="10%" align="center">卡产品类型</th>
						<th width="14%" align="center">卡产品名称</th>
						<th width="10%" align="center">卡片特性</th>
						<th width="10%" align="center">有效标志</th>
						<th width="10%" align="center">有效期（月）</th>
						<th width="10%" align="center">公交应用</th>
						<th width="10%" align="center">自行车应用</th>
						<th width="10%" align="center">图书馆应用</th>
						<th width="10%" align="center">小额消费应用</th>
						<!-- <th width="8%" align="center">创建日期</th>
						<th width="9%" align="center">创建员工</th>
						<th width="8%" align="center">最后修改日期</th>
						<th width="9%" align="center">最后修改该员工</th> -->
						<!-- <th width="0%" align="center" style="visibility:hidden;">卡产品代码</th> -->
					</tr>
				</thead>
				<tbody id="productCard">

				</tbody>
			</table>
		</div>
		<!-- <div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select id="numPerPageByproduct" name="numPerPage" onchange="paging(this,$('#getCardProduct'),getCardProductD)">
				<option value="20">20</option>
				<option value="30">30</option>
				<option value="50">50</option>
				<option value="100">100</option>
			</select>
			<span id="totalCountByProduct"></span>
		</div>
			<div id="paginationByProduct" class="pagination1"  ></div>
	</div> -->
		<div class="panelBar">
			<div class="pages">
				<span>显示</span> <select class="combox" name="numPerPage"
					onchange="navTabPageBreak({numPerPage:this.value},'productCard',getCardProductD)">
					<option value="20">20</option>
					<option value="50">50</option>
					<option value="100">100</option>
					<option value="200">200</option>
				</select> <span id="totalCountByProduct">条，共${totalCount}条</span>
			</div>

			<div callback='getCardProductD' id="paginationByProduct"
				rel="productCard" class="pagination" targetType="navTab"
				totalCount="200" numPerPage="5" pageNumShown="5" currentPage="1"></div>

		</div>
		<!-- <div class="formBar">
			<ul>
				<li>
					<div class="buttonActive">
						<div class="buttonContent">
							<button id="available" type="submit" param="start"
								onclick="return validateCheckBox(this);">启用</button>
						</div>
					</div>
				</li>
				<li>
					<div class="buttonActive">
						<div class="buttonContent">
							<button id="unavailable" type="submit" param="stop"
								onclick="return validateCheckBox(this);">停用</button>
						</div>
					</div>
				</li> 
			</ul>
		</div> -->

	</div>
</form>